home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
076-100
/
disk_089
/
autoenquirer
/
poster
< prev
next >
Wrap
Text File
|
1992-05-06
|
4KB
|
92 lines
Article 6213 of comp.sys.amiga:
Path: mcdsun!noao!hao!hull
From: hull@hao.UCAR.EDU (Howard Hull)
Newsgroups: comp.sys.amiga
Subject: autoEnquire() - a friendly but nosey requester
Keywords: positionable requester with memory & Gray's Terrain w/Manx dyn alloc
Message-ID: <775@hao.UCAR.EDU>
Date: 12 Jul 87 01:01:52 GMT
Distribution: na
Organization: High Altitude Obs./NCAR, Boulder CO
Lines: 831
This is a program that creates an example of a contraption that I wish to
call an "AutoEnquirer" - it's like a requester except it's not quite as
demanding and goes where you want to put it. I'd love to see this included
in 1.3 (CA: HINT, HINT). When you call Intuition's AutoRequest function,
you can specify the size, but not the location of the requester. The
autoEnquire function lets you specify the location, but not the size.
The autoEnquire contraption is nosey, like its namesake, but it also knows
that it can work better if it doesn't irritate you. It therefore also has
the property that if the user moves it (in order to see what's under it -
in case that's important to the question at hand) the next time it's
called, it shows up where the user left it last. To fabricate this beastie,
I snarfed a lot of code; I used giant hunks of John Draper's Menu and
Requester tutorial (from the WELL) and also used Chris Gray's Fractalish
Terrain Generator as a test bed. Since the Terrain generator would not
compile under Manx, I have it here for you in a 16-bit integer Manxification
by means of Dynamic Allocation. Also, I want to thank Steve Drew for the
Manx version of the Matt Dillon Shell, which has saved me a lot of disk
swaps, and Dave Wecker for the shar program used to package the stuff below.
To compile, unshar the mess below into an empty directory to get the header,
atv.h, the terrain code atv.c and the autoEnquirer code enq.c and then do
these commands to compile and link (Manx Aztec C 3.04a 512K Amiga 1000):
cc atv.c
cc enq.c
ln atv.c enq.c -lc
Now then, you sharks out there, realize that I am a VERY novice C programmer,
so this code is going evoke comments like "What th... why the HELL did he do
THAT!" I had to de-subroutinize a couple of things because I could not find
out how to define an array of pointers to dynamically allocated data which
could be transferred to a subroutine without evoking an error from Manx.
something like
#define XLIMIT 256L
#define YLIMIT 128L
...
short *Cell[256];
void boogie();
unsigned short n, m, i, j, x, y;
...
void boogie(Cell, p)
short *Cell[];
int p;
{
unsigned short l,c;
for (l=0; l<YLIMIT; l++)
{
for (c=0; c<XLIMIT)
{
Cell[n][m] = (short)(p*Cell[l][c]);
}
}
}
...
main()
{
...
Cell[n][m] = boogie(&Cell[0][0], (Cell[x][y] + Cell[i][j]))
...
}
gets tagged with an error concerning the subroutine definition of Cell.
So I want those comments! (Use EMAIL please.) That's also why I'm posting
this to just this newsgroup; there's no .uue file because this is a compiler
curiosity only (Gray's Terrain Generator has already been posted as compiled
under Draco, ok?) In looking this over, I just noticed one thing I should
have fixed - I used :ts=4 for tab stops in the Manx z editor. Since vi uses
8 spaces for tabs, there'll be trouble there and with many other editors.
For vi you can say ":set tabstop=4" and it should be a little more readable.
I'll be out of town all next week (they usually try to send me out of town
just before I put out a net article, it seems. I wonder why...) so don't
expect an immediate response.
Howard Hull
[If yet unproven concepts are outlawed in the range of discussion...
...Then only the deranged will discuss yet unproven concepts]
{ucbvax!hplabs | decvax!noao | mcvax!seismo | ihnp4!seismo} !hao!hull
for domain mailers: hull@hao.ucar.edu